package utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import exception.RuleBasedMonitoringException;

public class ConfigProperties {

	static ConfigProperties singleton;
	final String propsFileName = "config.properties";
	Properties props;

	public ConfigProperties () throws RuleBasedMonitoringException {
		InputStream file = ConfigProperties.class.getResourceAsStream(propsFileName);
		props = new Properties();
		try {
			props.load(file);
		} catch (IOException e) {
			throw (new RuleBasedMonitoringException(e));
		}
	}

	public static ConfigProperties getInstance () throws RuleBasedMonitoringException {
		if (singleton == null) {
			singleton = new ConfigProperties();
		}		
		return singleton;
	}

	public String getEmailFrom () {
		return props.getProperty("d_email");
	}

	public String getUName () {
		return props.getProperty("d_uname");
	}

	public String getPwd () {
		return props.getProperty("d_password");
	}

	public String getHost () {
		return props.getProperty("d_host");
	}

	public String getPort () {
		return props.getProperty("d_port");
	}

	public String getEmailTo () {
		return props.getProperty("m_to");
	}

	public String getDeploymentDir () {
		return props.getProperty("dir");
	}

	public String getEntryPoint() {
		return props.getProperty("entrypoint");
	}

}
